/*
 * TazioMessageID.java    0.0.1    08/dic/2009
 * 
 * Copyright (c) 2009 mentalsmash.org
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * The use of the Apache License does not indicate that this project is
 * affiliated with the Apache Software Foundation.
 */ 
package org.mentalsmash.tazio.transparency.commons.messages;

import java.io.Serializable;

import org.mentalsmash.tazio.commons.identifiers.NID;

/**
 * This is the identifier of each {@link TazioMessage} sent in the system. It is made of 
 * the combination of a {@link TazioNodeID} uniquely identifying the node in which the 
 * message has been created and an <code>int</code> value, which represents the sequence 
 * number of the message according to the history of the node. 
 * 
 * @version 0.0.1	08/dic/2009
 * @author Enrico Savioli <savioli.enrico@gmail.com>
 */
public interface TazioMessageID extends Serializable{

	/**
	 * This method is a method that will return the unique {@link NID} 
	 * identifying the node of the network where the message has been created. Used together 
	 * with the sequence number, it will work as an unique ordinal identifier for messages 
	 * sent from a node.
	 * 
	 * @return	the {@link NID} identifying the node in which it was created.
	 */
	NID getNodeID();
	
	/**
	 * This method will return the ordinal number of this message, with respect to the 
	 * others sent by the node where this had been originated. This number is not an unique 
	 * identifier, because all the nodes which create message could share this, but used in 
	 * conjunction with a {@link NID} this will work as a unique identifier 
	 * of the message for a single node.
	 * 
	 * @return	the sequence number associated with this message.	
	 */
	long getSequenceNumber();
	
}	
